-
Notifications
You must be signed in to change notification settings - Fork 6.3k
7105350: HttpExchange's attributes are the same as HttpContext's attributes #27652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back SentryMan! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
@SentryMan The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably need a test for this as well
private static final boolean perExchangeAttributes = | ||
!System.getProperty("jdk.httpserver.attributes", "") | ||
.equals("context"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The property will have to be documented somewhere such as the jdk.httpserver module-info. But, I'm wondering if fairly obscure properties like this might be better off "buried" in the net.properties config file. I think there's a case for putting all such "compatibility" flags somewhere out of the way like that. If we were to do that, you would need to access the property using sun.net.NetProperties
.
Any other views on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can switch to sun.net.NetProperties
if you so desire.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think we should put the property in net.properties
something like this:
# Prior to JDK 26, the HttpExchange attribute map was shared with the enclosing HttpContext.
# Since JDK 26, by default, exchange attributes are per-exchange and the context attributes must
# be accessed by calling getHttpContext().getAttributes(). Uncomment this property to
# restore the pre JDK 26 behavior.
#
# jdk.httpserver.attributes=context
Then I think we should add a sentence at the end of the jdk.httpserver module-info to say that additional
system/networking properties may be defined in net.properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That proposal sounds good to me. Documenting the compatibiity in net.properties makes sense.
src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java
Outdated
Show resolved
Hide resolved
src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @Michael-Mc-Mahon that we will need a test to verify both old (with property set) and new behavior. Also this change will require a CSR and release notes.
Otherwise the proposed solution looks good. I believe it meets what a user reading the documentation would expect: get/set attributes on context get/set attributes for the whole context and may be observed by all exchanges that operate on this context. get/set attribute on the exchange get/set attributes whose scope is limited to that particular exchange.
This was a long standing issue and I'm happy to see it fixed. Thanks for driving that @SentryMan and @Michael-Mc-Mahon !
private static final boolean perExchangeAttributes = | ||
!System.getProperty("jdk.httpserver.attributes", "") | ||
.equals("context"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That proposal sounds good to me. Documenting the compatibiity in net.properties makes sense.
@SentryMan |
/csr needed |
@dfuch has indicated that a compatibility and specification (CSR) request is needed for this pull request. @SentryMan please create a CSR request for issue JDK-7105350 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
How should I go about creating a CSR? The FAQ on this page says that I need JIRA access (I don't have that) |
@SentryMan note: WRT to creating a CSR your sponsor will handle that if you do not have a JBS account. Let's wait until this PR has been approved and everyone is happy with the API doc / behaviours changes. |
java.net.http, | ||
jdk.naming.dns; | ||
jdk.naming.dns, | ||
jdk.httpserver; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good if we could avoid giving the jdk.httpserver module access to the sun.net.* package.
@dfuch @Michael-Mc-Mahon Are you sure that net.properties is the right place for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlanBateman I hadn't realised that the HttpServer didn't already have access to sun.net.*
- and I agree that it would be better if we did not add such an access. That said - the new property is a compatibility property - and documenting in module-info seemed a bit too much - so out of the way in net.properties
seemed like an appealing place to add it.
Another possibility could be to document it only in the release notes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall I revert the change and leave as a system property?
Now ExchangeImpl will default to having a separate attribute map for the request duration.
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27652/head:pull/27652
$ git checkout pull/27652
Update a local copy of the PR:
$ git checkout pull/27652
$ git pull https://git.openjdk.org/jdk.git pull/27652/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27652
View PR using the GUI difftool:
$ git pr show -t 27652
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27652.diff
Using Webrev
Link to Webrev Comment